package cn.cdut.yiwenqian.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

/**
 * CdutPostAnswers entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "CDUT_POST_ANSWERS", catalog = "cdutpostbar")
public class CdutPostAnswers implements java.io.Serializable {

	// Fields

	private Integer unumber;
	private CdutPostUsers cdutPostUsers;
	private CdutPostTitles cdutPostTitles;
	private Date beginDate;
	private Set<CdutPostVidsrc> cdutPostVidsrcs = new HashSet<CdutPostVidsrc>(0);
	private Set<CdutPostTxtsrc> cdutPostTxtsrcs = new HashSet<CdutPostTxtsrc>(0);
	private Set<CdutPostImgsrc> cdutPostImgsrcs = new HashSet<CdutPostImgsrc>(0);

	// Constructors

	/** default constructor */
	public CdutPostAnswers() {
	}

	/** minimal constructor */
	public CdutPostAnswers(Integer unumber) {
		this.unumber = unumber;
	}

	/** full constructor */
	public CdutPostAnswers(Integer unumber, CdutPostUsers cdutPostUsers,
			CdutPostTitles cdutPostTitles, Date beginDate,
			Set<CdutPostVidsrc> cdutPostVidsrcs,
			Set<CdutPostTxtsrc> cdutPostTxtsrcs,
			Set<CdutPostImgsrc> cdutPostImgsrcs) {
		this.unumber = unumber;
		this.cdutPostUsers = cdutPostUsers;
		this.cdutPostTitles = cdutPostTitles;
		this.beginDate = beginDate;
		this.cdutPostVidsrcs = cdutPostVidsrcs;
		this.cdutPostTxtsrcs = cdutPostTxtsrcs;
		this.cdutPostImgsrcs = cdutPostImgsrcs;
	}

	// Property accessors
	@Id
	@GeneratedValue(generator="answerIdGenerator")
	@GenericGenerator(name="answerIdGenerator",strategy="increment")
	@Column(name = "unumber", unique = true, nullable = false)
	public Integer getUnumber() {
		return this.unumber;
	}

	public void setUnumber(Integer unumber) {
		this.unumber = unumber;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "auther")
	public CdutPostUsers getCdutPostUsers() {
		return this.cdutPostUsers;
	}

	public void setCdutPostUsers(CdutPostUsers cdutPostUsers) {
		this.cdutPostUsers = cdutPostUsers;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "postTitle")
	public CdutPostTitles getCdutPostTitles() {
		return this.cdutPostTitles;
	}

	public void setCdutPostTitles(CdutPostTitles cdutPostTitles) {
		this.cdutPostTitles = cdutPostTitles;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "beginDate", length = 10)
	public Date getBeginDate() {
		return this.beginDate;
	}

	public void setBeginDate(Date beginDate) {
		this.beginDate = beginDate;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cdutPostAnswers")
	public Set<CdutPostVidsrc> getCdutPostVidsrcs() {
		return this.cdutPostVidsrcs;
	}

	public void setCdutPostVidsrcs(Set<CdutPostVidsrc> cdutPostVidsrcs) {
		this.cdutPostVidsrcs = cdutPostVidsrcs;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cdutPostAnswers")
	public Set<CdutPostTxtsrc> getCdutPostTxtsrcs() {
		return this.cdutPostTxtsrcs;
	}

	public void setCdutPostTxtsrcs(Set<CdutPostTxtsrc> cdutPostTxtsrcs) {
		this.cdutPostTxtsrcs = cdutPostTxtsrcs;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cdutPostAnswers")
	public Set<CdutPostImgsrc> getCdutPostImgsrcs() {
		return this.cdutPostImgsrcs;
	}

	public void setCdutPostImgsrcs(Set<CdutPostImgsrc> cdutPostImgsrcs) {
		this.cdutPostImgsrcs = cdutPostImgsrcs;
	}

}